home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 April: Mac OS SDK / Dev.CD Apr 00 SDK1.toast / Development Kits / Mac OS / GameSprocket SDKs / InputSprocket_SDK / Interfaces&Libraries / InputSprocket.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-10-29  |  40.4 KB  |  1,316 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        InputSprocket.h
  3.  
  4.      Contains:    Games Sprockets: InputSprocket interfaaces
  5.  
  6.      Version:    Technology:    InputSprocket 1.7
  7.                  Release:    InputSprocket SDK, Use 3.2 Universal Headers
  8.  
  9.      Copyright:    © 1996-1999 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __INPUTSPROCKET__
  18. #define __INPUTSPROCKET__
  19.  
  20. #ifndef __DESKBUS__
  21. #include <DeskBus.h>
  22. #endif
  23.  
  24. #ifndef __DIALOGS__
  25. #include <Dialogs.h>
  26. #endif
  27.  
  28. #ifndef __EVENTS__
  29. #include <Events.h>
  30. #endif
  31.  
  32. #ifndef __ICONS__
  33. #include <Icons.h>
  34. #endif
  35.  
  36. #ifndef __MACTYPES__
  37. #include <MacTypes.h>
  38. #endif
  39.  
  40.  
  41.  
  42.  
  43. #if PRAGMA_ONCE
  44. #pragma once
  45. #endif
  46.  
  47. #ifdef __cplusplus
  48. extern "C" {
  49. #endif
  50.  
  51. #if PRAGMA_IMPORT
  52. #pragma import on
  53. #endif
  54.  
  55. #if PRAGMA_STRUCT_ALIGN
  56.     #pragma options align=power
  57. #elif PRAGMA_STRUCT_PACKPUSH
  58.     #pragma pack(push, 2)
  59. #elif PRAGMA_STRUCT_PACK
  60.     #pragma pack(2)
  61. #endif
  62.  
  63. #ifndef USE_OLD_INPUT_SPROCKET_LABELS
  64. #define USE_OLD_INPUT_SPROCKET_LABELS 0
  65. #endif  /* !defined(USE_OLD_INPUT_SPROCKET_LABELS) */
  66.  
  67. #ifndef USE_OLD_ISPNEED_STRUCT
  68. #define USE_OLD_ISPNEED_STRUCT 0
  69. #endif  /* !defined(USE_OLD_ISPNEED_STRUCT) */
  70.  
  71. /* ********************* data types ********************* */
  72. typedef struct OpaqueISpDeviceReference*  ISpDeviceReference;
  73. typedef struct OpaqueISpElementReference*  ISpElementReference;
  74. typedef struct OpaqueISpElementListReference*  ISpElementListReference;
  75. /* ISpDeviceClass is a general classs of device, example: keyboard, mouse, joystick */
  76. typedef OSType                             ISpDeviceClass;
  77. /* ISpDeviceIdentifier is a specific device,  example: standard 1-button mouse, 105key ext. kbd. */
  78. typedef OSType                             ISpDeviceIdentifier;
  79. typedef OSType                             ISpElementLabel;
  80. typedef OSType                             ISpElementKind;
  81.  
  82. /* *************** errors -30420 to -30439***************** */
  83. enum {
  84.     kISpInternalErr                = -30420,
  85.     kISpSystemListErr            = -30421,
  86.     kISpBufferToSmallErr        = -30422,
  87.     kISpElementInListErr        = -30423,
  88.     kISpElementNotInListErr        = -30424,
  89.     kISpSystemInactiveErr        = -30425,
  90.     kISpDeviceInactiveErr        = -30426,
  91.     kISpSystemActiveErr            = -30427,
  92.     kISpDeviceActiveErr            = -30428,
  93.     kISpListBusyErr                = -30429
  94. };
  95.  
  96. /* *************** resources **************** */
  97. enum {
  98.     kISpApplicationResourceType    = FOUR_CHAR_CODE('isap'),
  99.     kISpSetListResourceType        = FOUR_CHAR_CODE('setl'),
  100.     kISpSetDataResourceType        = FOUR_CHAR_CODE('setd')
  101. };
  102.  
  103.  
  104. struct ISpApplicationResourceStruct {
  105.     UInt32                             flags;
  106.     UInt32                             reserved1;
  107.     UInt32                             reserved2;
  108.     UInt32                             reserved3;
  109. };
  110. typedef struct ISpApplicationResourceStruct ISpApplicationResourceStruct;
  111. enum {
  112.     kISpAppResFlag_UsesInputSprocket = 0x00000001,                /* true if the application uses InputSprocket*/
  113.     kISpAppResFlag_UsesISpInit    = 0x00000002                    /* true if the calls ISpInit (ie, uses the high level interface, calls ISpConfigure, has a needs list, etc...)*/
  114. };
  115.  
  116. /*
  117.  * ISpDeviceDefinition
  118.  *
  119.  * This structure provides all the available
  120.  * information for an input device within the system
  121.  *
  122.  */
  123.  
  124. struct ISpDeviceDefinition {
  125.     Str63                             deviceName;                    /* a human readable name of the device */
  126.     ISpDeviceClass                     theDeviceClass;                /* general classs of device example : keyboard, mouse, joystick */
  127.     ISpDeviceIdentifier             theDeviceIdentifier;        /* every distinguishable device should have an OSType */
  128.     UInt32                             permanentID;                /* a cross reboot id unique within that deviceType, 0 if not possible */
  129.     UInt32                             flags;                        /* status flags */
  130.     UInt32                             permanentIDExtend;            /* extension of permanentID, so 64 bits total are now significant */
  131.     UInt32                             reserved2;
  132.     UInt32                             reserved3;
  133. };
  134. typedef struct ISpDeviceDefinition        ISpDeviceDefinition;
  135. enum {
  136.     kISpDeviceFlag_HandleOwnEmulation = 1
  137. };
  138.  
  139. /*
  140.  * ISpElementEvent, ISpElementEventPtr
  141.  *
  142.  * This is the structure that event data is passed in.
  143.  *
  144.  */
  145.  
  146. struct ISpElementEvent {
  147.     AbsoluteTime                     when;                        /* this is absolute time on PCI or later, otherwise it is */
  148.                                                                 /* 0 for the hi 32 bits and TickCount for the low 32 bits */
  149.     ISpElementReference             element;                    /* a reference to the element that generated this event */
  150.     UInt32                             refCon;                        /* for application usage, 0 on the global list */
  151.     UInt32                             data;                        /* the data for this event */
  152. };
  153. typedef struct ISpElementEvent            ISpElementEvent;
  154. typedef ISpElementEvent *                ISpElementEventPtr;
  155. /*
  156.  * ISpElementInfo, ISpElementInfoPtr
  157.  *
  158.  * This is the generic definition of an element.
  159.  * Every element must contain this information.
  160.  *
  161.  */
  162.  
  163. struct ISpElementInfo {
  164.     ISpElementLabel                 theLabel;
  165.     ISpElementKind                     theKind;
  166.     Str63                             theString;
  167.     UInt32                             reserved1;
  168.     UInt32                             reserved2;
  169. };
  170. typedef struct ISpElementInfo            ISpElementInfo;
  171. typedef ISpElementInfo *                ISpElementInfoPtr;
  172.  
  173. typedef UInt32                             ISpNeedFlagBits;
  174. #if USE_OLD_ISPNEED_STRUCT
  175.  
  176. struct ISpNeed {
  177.     Str63                             name;
  178.     short                             iconSuiteResourceId;        /* resource id of the icon suite */
  179.     short                             reserved;
  180.     ISpElementKind                     theKind;
  181.     ISpElementLabel                 theLabel;
  182.     ISpNeedFlagBits                 flags;
  183.     UInt32                             reserved1;
  184.     UInt32                             reserved2;
  185.     UInt32                             reserved3;
  186. };
  187. typedef struct ISpNeed                    ISpNeed;
  188. #else
  189.  
  190. struct ISpNeed {
  191.     Str63                             name;                        /* human-readable string */
  192.     short                             iconSuiteResourceId;        /* resource id of the icon suite */
  193.     UInt8                             playerNum;                    /* used for multi-player support */
  194.     UInt8                             group;                        /* used to group related needs (eg, look left and look right button needs) */
  195.     ISpElementKind                     theKind;
  196.     ISpElementLabel                 theLabel;
  197.     ISpNeedFlagBits                 flags;
  198.     UInt32                             reserved1;
  199.     UInt32                             reserved2;
  200.     UInt32                             reserved3;
  201. };
  202. typedef struct ISpNeed                    ISpNeed;
  203. #endif  /* USE_OLD_ISPNEED_STRUCT */
  204.  
  205. enum {
  206.     kISpNeedFlag_NoMultiConfig    = 0x00000001,                    /* once this need is autoconfigured to one device dont autoconfigure to anything else*/
  207.     kISpNeedFlag_Utility        = 0x00000002,                    /* this need is a utility function (like show framerate) which would not typically be assigned to anything but the keyboard*/
  208.     kISpNeedFlag_PolledOnly        = 0x00000004,
  209.     kISpNeedFlag_EventsOnly        = 0x00000008,
  210.     kISpNeedFlag_NoAutoConfig    = 0x00000010,                    /* this need can be set normally, but will not ever be auto configured*/
  211.     kISpNeedFlag_NoConfig        = 0x00000020,                    /* this need can not be changed by the user*/
  212.     kISpNeedFlag_Invisible        = 0x00000040,                    /* this need can not be seen by the user*/
  213.                                                                 /* *** kISpElementKind specific flags ****/
  214.                                                                 /* these are flags specific to kISpElementKind_Button*/
  215.     kISpNeedFlag_Button_AlreadyAxis = 0x10000000,                /* there is a axis version of this button need*/
  216.     kISpNeedFlag_Button_ClickToggles = 0x20000000,
  217.     kISpNeedFlag_Button_ActiveWhenDown = 0x40000000,
  218.     kISpNeedFlag_Button_AlreadyDelta = (long)0x80000000,        /* there is a delta version of this button need*/
  219.                                                                 /* these are flags specific to kISpElementKind_DPad*/
  220.                                                                 /* these are flags specific to kISpElementKind_Axis*/
  221.     kISpNeedFlag_Axis_AlreadyButton = 0x10000000,                /* there is a button version of this axis need*/
  222.     kISpNeedFlag_Axis_Asymetric    = 0x20000000,                    /* this axis need is asymetric    */
  223.     kISpNeedFlag_Axis_AlreadyDelta = 0x40000000,                /* there is a delta version of this axis need*/
  224.                                                                 /* these are flags specific to kISpElementKind_Delta*/
  225.     kISpNeedFlag_Delta_AlreadyAxis = 0x10000000,                /* there is a axis version of this delta need*/
  226.     kISpNeedFlag_Delta_AlreadyButton = 0x20000000                /* there is a button version of this delta need*/
  227. };
  228.  
  229. /*
  230.  *
  231.  * These are the current built values for ISpDeviceClass
  232.  *
  233.  */
  234. enum {
  235.     kISpDeviceClass_SpeechRecognition = FOUR_CHAR_CODE('talk'),
  236.     kISpDeviceClass_Mouse        = FOUR_CHAR_CODE('mous'),
  237.     kISpDeviceClass_Keyboard    = FOUR_CHAR_CODE('keyd'),
  238.     kISpDeviceClass_Joystick    = FOUR_CHAR_CODE('joys'),
  239.     kISpDeviceClass_Gamepad        = FOUR_CHAR_CODE('gmpd'),
  240.     kISpDeviceClass_Wheel        = FOUR_CHAR_CODE('whel'),
  241.     kISpDeviceClass_Pedals        = FOUR_CHAR_CODE('pedl'),
  242.     kISpDeviceClass_Levers        = FOUR_CHAR_CODE('levr'),
  243.     kISpDeviceClass_Tickle        = FOUR_CHAR_CODE('tckl'),        /* a device of this class requires ISpTickle*/
  244.     kISpDeviceClass_Unknown        = FOUR_CHAR_CODE('????')
  245. };
  246.  
  247. /*
  248.  * These are the current built in ISpElementKind's
  249.  * 
  250.  * These are all OSTypes.
  251.  *
  252.  */
  253. enum {
  254.     kISpElementKind_Button        = FOUR_CHAR_CODE('butn'),
  255.     kISpElementKind_DPad        = FOUR_CHAR_CODE('dpad'),
  256.     kISpElementKind_Axis        = FOUR_CHAR_CODE('axis'),
  257.     kISpElementKind_Delta        = FOUR_CHAR_CODE('dlta'),
  258.     kISpElementKind_Movement    = FOUR_CHAR_CODE('move'),
  259.     kISpElementKind_Virtual        = FOUR_CHAR_CODE('virt')
  260. };
  261.  
  262.  
  263. /*
  264.  *
  265.  * These are the current built in ISpElementLabel's
  266.  *
  267.  * These are all OSTypes.
  268.  *
  269.  */
  270. #if USE_OLD_INPUT_SPROCKET_LABELS
  271. enum {
  272.                                                                 /* axis */
  273.     kISpElementLabel_XAxis        = FOUR_CHAR_CODE('xaxi'),
  274.     kISpElementLabel_YAxis        = FOUR_CHAR_CODE('yaxi'),
  275.     kISpElementLabel_ZAxis        = FOUR_CHAR_CODE('zaxi'),
  276.     kISpElementLabel_Rx            = FOUR_CHAR_CODE('rxax'),
  277.     kISpElementLabel_Ry            = FOUR_CHAR_CODE('ryax'),
  278.     kISpElementLabel_Rz            = FOUR_CHAR_CODE('rzax'),
  279.     kISpElementLabel_Gas        = FOUR_CHAR_CODE('gasp'),
  280.     kISpElementLabel_Brake        = FOUR_CHAR_CODE('brak'),
  281.     kISpElementLabel_Clutch        = FOUR_CHAR_CODE('cltc'),
  282.     kISpElementLabel_Throttle    = FOUR_CHAR_CODE('thrt'),
  283.     kISpElementLabel_Trim        = FOUR_CHAR_CODE('trim'),        /* direction pad */
  284.     kISpElementLabel_POVHat        = FOUR_CHAR_CODE('povh'),
  285.     kISpElementLabel_PadMove    = FOUR_CHAR_CODE('move'),        /* buttons */
  286.     kISpElementLabel_Fire        = FOUR_CHAR_CODE('fire'),
  287.     kISpElementLabel_Start        = FOUR_CHAR_CODE('strt'),
  288.     kISpElementLabel_Select        = FOUR_CHAR_CODE('optn'),        /* Pause/Resume was changed into 2 needs: Quit and start/pause */
  289.     kISpElementLabel_Btn_PauseResume = FOUR_CHAR_CODE('strt')
  290. };
  291.  
  292. #endif  /* USE_OLD_INPUT_SPROCKET_LABELS */
  293.  
  294. enum {
  295.                                                                 /* generic */
  296.     kISpElementLabel_None        = FOUR_CHAR_CODE('none'),        /* axis */
  297.     kISpElementLabel_Axis_XAxis    = FOUR_CHAR_CODE('xaxi'),
  298.     kISpElementLabel_Axis_YAxis    = FOUR_CHAR_CODE('yaxi'),
  299.     kISpElementLabel_Axis_ZAxis    = FOUR_CHAR_CODE('zaxi'),
  300.     kISpElementLabel_Axis_Rx    = FOUR_CHAR_CODE('rxax'),
  301.     kISpElementLabel_Axis_Ry    = FOUR_CHAR_CODE('ryax'),
  302.     kISpElementLabel_Axis_Rz    = FOUR_CHAR_CODE('rzax'),
  303.     kISpElementLabel_Axis_Roll    = kISpElementLabel_Axis_Rz,
  304.     kISpElementLabel_Axis_Pitch    = kISpElementLabel_Axis_Rx,
  305.     kISpElementLabel_Axis_Yaw    = kISpElementLabel_Axis_Ry,
  306.     kISpElementLabel_Axis_RollTrim = FOUR_CHAR_CODE('rxtm'),
  307.     kISpElementLabel_Axis_PitchTrim = FOUR_CHAR_CODE('trim'),
  308.     kISpElementLabel_Axis_YawTrim = FOUR_CHAR_CODE('rytm'),
  309.     kISpElementLabel_Axis_Gas    = FOUR_CHAR_CODE('gasp'),
  310.     kISpElementLabel_Axis_Brake    = FOUR_CHAR_CODE('brak'),
  311.     kISpElementLabel_Axis_Clutch = FOUR_CHAR_CODE('cltc'),
  312.     kISpElementLabel_Axis_Throttle = FOUR_CHAR_CODE('thrt'),
  313.     kISpElementLabel_Axis_Trim    = kISpElementLabel_Axis_PitchTrim,
  314.     kISpElementLabel_Axis_Rudder = FOUR_CHAR_CODE('rudd'),
  315.     kISpElementLabel_Axis_ToeBrake = FOUR_CHAR_CODE('toeb'),    /* delta */
  316.     kISpElementLabel_Delta_X    = FOUR_CHAR_CODE('xdlt'),
  317.     kISpElementLabel_Delta_Y    = FOUR_CHAR_CODE('ydlt'),
  318.     kISpElementLabel_Delta_Z    = FOUR_CHAR_CODE('zdlt'),
  319.     kISpElementLabel_Delta_Rx    = FOUR_CHAR_CODE('rxdl'),
  320.     kISpElementLabel_Delta_Ry    = FOUR_CHAR_CODE('rydl'),
  321.     kISpElementLabel_Delta_Rz    = FOUR_CHAR_CODE('rzdl'),
  322.     kISpElementLabel_Delta_Roll    = kISpElementLabel_Delta_Rz,
  323.     kISpElementLabel_Delta_Pitch = kISpElementLabel_Delta_Rx,
  324.     kISpElementLabel_Delta_Yaw    = kISpElementLabel_Delta_Ry,
  325.     kISpElementLabel_Delta_Cursor_X = FOUR_CHAR_CODE('curx'),
  326.     kISpElementLabel_Delta_Cursor_Y = FOUR_CHAR_CODE('cury'),    /* direction pad */
  327.     kISpElementLabel_Pad_POV    = FOUR_CHAR_CODE('povh'),        /* up/down/left/right*/
  328.     kISpElementLabel_Pad_Move    = FOUR_CHAR_CODE('move'),        /* up/down/left/right*/
  329.     kISpElementLabel_Pad_POV_Horiz = FOUR_CHAR_CODE('hpov'),    /* forward/back/left/right*/
  330.     kISpElementLabel_Pad_Move_Horiz = FOUR_CHAR_CODE('hmov'),    /* forward/back/left/right*/
  331.                                                                 /* buttons */
  332.     kISpElementLabel_Btn_Fire    = FOUR_CHAR_CODE('fire'),
  333.     kISpElementLabel_Btn_SecondaryFire = FOUR_CHAR_CODE('sfir'),
  334.     kISpElementLabel_Btn_Jump    = FOUR_CHAR_CODE('jump'),
  335.     kISpElementLabel_Btn_Quit    = FOUR_CHAR_CODE('strt'),        /* kISpElementLabel_Btn_Quit automatically binds to escape */
  336.     kISpElementLabel_Btn_StartPause = FOUR_CHAR_CODE('paus'),
  337.     kISpElementLabel_Btn_Select    = FOUR_CHAR_CODE('optn'),
  338.     kISpElementLabel_Btn_SlideLeft = FOUR_CHAR_CODE('blft'),
  339.     kISpElementLabel_Btn_SlideRight = FOUR_CHAR_CODE('brgt'),
  340.     kISpElementLabel_Btn_MoveForward = FOUR_CHAR_CODE('btmf'),
  341.     kISpElementLabel_Btn_MoveBackward = FOUR_CHAR_CODE('btmb'),
  342.     kISpElementLabel_Btn_TurnLeft = FOUR_CHAR_CODE('bttl'),
  343.     kISpElementLabel_Btn_TurnRight = FOUR_CHAR_CODE('bttr'),
  344.     kISpElementLabel_Btn_LookLeft = FOUR_CHAR_CODE('btll'),
  345.     kISpElementLabel_Btn_LookRight = FOUR_CHAR_CODE('btlr'),
  346.     kISpElementLabel_Btn_LookUp    = FOUR_CHAR_CODE('btlu'),
  347.     kISpElementLabel_Btn_LookDown = FOUR_CHAR_CODE('btld'),
  348.     kISpElementLabel_Btn_Next    = FOUR_CHAR_CODE('btnx'),
  349.     kISpElementLabel_Btn_Previous = FOUR_CHAR_CODE('btpv'),
  350.     kISpElementLabel_Btn_SideStep = FOUR_CHAR_CODE('side'),
  351.     kISpElementLabel_Btn_Run    = FOUR_CHAR_CODE('quik'),
  352.     kISpElementLabel_Btn_Look    = FOUR_CHAR_CODE('blok'),
  353.     kISpElementLabel_Btn_Minimum = FOUR_CHAR_CODE('min '),
  354.     kISpElementLabel_Btn_Decrement = FOUR_CHAR_CODE('decr'),
  355.     kISpElementLabel_Btn_Center    = FOUR_CHAR_CODE('cent'),
  356.     kISpElementLabel_Btn_Increment = FOUR_CHAR_CODE('incr'),
  357.     kISpElementLabel_Btn_Maximum = FOUR_CHAR_CODE('max '),
  358.     kISpElementLabel_Btn_10Percent = FOUR_CHAR_CODE(' 10 '),
  359.     kISpElementLabel_Btn_20Percent = FOUR_CHAR_CODE(' 20 '),
  360.     kISpElementLabel_Btn_30Percent = FOUR_CHAR_CODE(' 30 '),
  361.     kISpElementLabel_Btn_40Percent = FOUR_CHAR_CODE(' 40 '),
  362.     kISpElementLabel_Btn_50Percent = FOUR_CHAR_CODE(' 50 '),
  363.     kISpElementLabel_Btn_60Percent = FOUR_CHAR_CODE(' 60 '),
  364.     kISpElementLabel_Btn_70Percent = FOUR_CHAR_CODE(' 70 '),
  365.     kISpElementLabel_Btn_80Percent = FOUR_CHAR_CODE(' 80 '),
  366.     kISpElementLabel_Btn_90Percent = FOUR_CHAR_CODE(' 90 '),
  367.     kISpElementLabel_Btn_MouseOne = FOUR_CHAR_CODE('mou1'),
  368.     kISpElementLabel_Btn_MouseTwo = FOUR_CHAR_CODE('mou2'),
  369.     kISpElementLabel_Btn_MouseThree = FOUR_CHAR_CODE('mou3')
  370. };
  371.  
  372. /*
  373.  *
  374.  * direction pad data & configuration information
  375.  *
  376.  */
  377.  
  378. typedef UInt32                             ISpDPadData;
  379. enum {
  380.     kISpPadIdle                    = 0,
  381.     kISpPadLeft                    = 1,
  382.     kISpPadUpLeft                = 2,
  383.     kISpPadUp                    = 3,
  384.     kISpPadUpRight                = 4,
  385.     kISpPadRight                = 5,
  386.     kISpPadDownRight            = 6,
  387.     kISpPadDown                    = 7,
  388.     kISpPadDownLeft                = 8
  389. };
  390.  
  391.  
  392. struct ISpDPadConfigurationInfo {
  393.     UInt32                             id;                            /* ordering 1..n, 0 = no relavent ordering of direction pads */
  394.     Boolean                         fourWayPad;                    /* true if this pad can only produce idle + four directions */
  395. };
  396. typedef struct ISpDPadConfigurationInfo    ISpDPadConfigurationInfo;
  397. /*
  398.  *
  399.  * button data & configuration information
  400.  *
  401.  */
  402.  
  403. typedef UInt32                             ISpButtonData;
  404. enum {
  405.     kISpButtonUp                = 0,
  406.     kISpButtonDown                = 1
  407. };
  408.  
  409.  
  410. struct ISpButtonConfigurationInfo {
  411.     UInt32                             id;                            /* ordering 1..n, 0 = no relavent ordering of buttons */
  412. };
  413. typedef struct ISpButtonConfigurationInfo ISpButtonConfigurationInfo;
  414. /*
  415.  *
  416.  * axis data & configuration information 
  417.  *
  418.  */
  419.  
  420. typedef UInt32                             ISpAxisData;
  421.  
  422. #define    kISpAxisMinimum  0x00000000U
  423. #define    kISpAxisMiddle   0x7FFFFFFFU
  424. #define    kISpAxisMaximum  0xFFFFFFFFU
  425.  
  426.  
  427. struct ISpAxisConfigurationInfo {
  428.     Boolean                         symetricAxis;                /* axis is symetric, i.e. a joystick is symetric and a gas pedal is not */
  429. };
  430. typedef struct ISpAxisConfigurationInfo    ISpAxisConfigurationInfo;
  431.  
  432. typedef Fixed                             ISpDeltaData;
  433.  
  434. struct ISpDeltaConfigurationInfo {
  435.     UInt32                             reserved1;
  436.     UInt32                             reserved2;
  437. };
  438. typedef struct ISpDeltaConfigurationInfo ISpDeltaConfigurationInfo;
  439.  
  440. struct ISpMovementData {
  441.     ISpAxisData                     xAxis;
  442.     ISpAxisData                     yAxis;
  443.     ISpDPadData                     direction;                    /* ISpDPadData version of the movement */
  444. };
  445. typedef struct ISpMovementData            ISpMovementData;
  446.  
  447. struct ISpMovementConfigurationInfo {
  448.     UInt32                             reserved1;
  449.     UInt32                             reserved2;
  450. };
  451. typedef struct ISpMovementConfigurationInfo ISpMovementConfigurationInfo;
  452. enum {
  453.     kISpVirtualElementFlag_UseTempMem = 1
  454. };
  455.  
  456. enum {
  457.     kISpElementListFlag_UseTempMem = 1
  458. };
  459.  
  460. enum {
  461.     kISpFirstIconSuite            = 30000,
  462.     kISpLastIconSuite            = 30100,
  463.     kISpNoneIconSuite            = 30000
  464. };
  465.  
  466.  
  467. /* ********************* user level functions ********************* */
  468. /*
  469.  *
  470.  * startup / shutdown
  471.  *
  472.  */
  473. EXTERN_API_C( OSStatus )
  474. ISpStartup                        (void);
  475.  
  476. /* 1.1 or later*/
  477. EXTERN_API_C( OSStatus )
  478. ISpShutdown                        (void);
  479.  
  480. /* 1.1 or later*/
  481. /*
  482.  *
  483.  * polling
  484.  *
  485.  */
  486. EXTERN_API_C( OSStatus )
  487. ISpTickle                        (void);
  488.  
  489. /* 1.1 or later*/
  490. /********** user interface functions **********/
  491.  
  492. EXTERN_API_C( NumVersion )
  493. ISpGetVersion                    (void);
  494.  
  495. /*
  496.  *
  497.  * ISpElement_NewVirtual(ISpElementReference *outElement);
  498.  *
  499.  */
  500. EXTERN_API_C( OSStatus )
  501. ISpElement_NewVirtual            (UInt32                 dataSize,
  502.                                  ISpElementReference *    outElement,
  503.                                  UInt32                 flags);
  504.  
  505. /*
  506.  *
  507.  * ISpElement_NewVirtualFromNeeds(UInt32 count, ISpNeeds *needs, ISpElementReference *outElements);
  508.  *
  509.  */
  510. EXTERN_API_C( OSStatus )
  511. ISpElement_NewVirtualFromNeeds    (UInt32                 count,
  512.                                  ISpNeed *                needs,
  513.                                  ISpElementReference *    outElements,
  514.                                  UInt32                 flags);
  515.  
  516. /*
  517.  *
  518.  * ISpElement_DisposeVirtual(inElement);
  519.  *
  520.  */
  521. EXTERN_API_C( OSStatus )
  522. ISpElement_DisposeVirtual        (UInt32                 count,
  523.                                  ISpElementReference *    inElements);
  524.  
  525. /*
  526.  * ISpInit
  527.  *
  528.  */
  529. EXTERN_API_C( OSStatus )
  530. ISpInit                            (UInt32                 count,
  531.                                  ISpNeed *                needs,
  532.                                  ISpElementReference *    inReferences,
  533.                                  OSType                 appCreatorCode,
  534.                                  OSType                 subCreatorCode,
  535.                                  UInt32                 flags,
  536.                                  short                     setListResourceId,
  537.                                  UInt32                 reserved);
  538.  
  539.  
  540. /*
  541.  * ISpConfigure
  542.  *
  543.  */
  544. typedef CALLBACK_API_C( Boolean , ISpEventProcPtr )(EventRecord *inEvent);
  545. EXTERN_API_C( OSStatus )
  546. ISpConfigure                    (ISpEventProcPtr         inEventProcPtr);
  547.  
  548. /*
  549.  *
  550.  * ISpStop
  551.  *
  552.  */
  553. EXTERN_API_C( OSStatus )
  554. ISpStop                            (void);
  555.  
  556. /*
  557.  *
  558.  * ISpSuspend, ISpResume
  559.  *
  560.  * ISpSuspend turns all devices off and allocates memory so that the state may be later resumed.
  561.  * ISpResume resumes to the previous state of the system after a suspend call.
  562.  * 
  563.  * Return Codes
  564.  * memFullErr
  565.  *
  566.  */
  567. EXTERN_API_C( OSStatus )
  568. ISpSuspend                        (void);
  569.  
  570. EXTERN_API_C( OSStatus )
  571. ISpResume                        (void);
  572.  
  573. /*
  574.  * ISpDevices_Extract, ISpDevices_ExtractByClass, ISpDevices_ExtractByIdentifier
  575.  *
  576.  * These will extract as many device references from the system wide list as will fit in your buffer.  
  577.  *
  578.  * inBufferCount - the size of your buffer (in units of sizeof(ISpDeviceReference)) this may be zero
  579.  * buffer - a pointer to your buffer
  580.  * outCount - contains the number of devices in the system
  581.  *
  582.  * ISpDevices_ExtractByClass extracts and counts devices of the specified ISpDeviceClass
  583.  * ISpDevices_ExtractByIdentifier extracts and counts devices of the specified ISpDeviceIdentifier
  584.  *
  585.  * Return Codes
  586.  * paramErr
  587.  *
  588.  */
  589. EXTERN_API_C( OSStatus )
  590. ISpDevices_Extract                (UInt32                 inBufferCount,
  591.                                  UInt32 *                outCount,
  592.                                  ISpDeviceReference *    buffer);
  593.  
  594. EXTERN_API_C( OSStatus )
  595. ISpDevices_ExtractByClass        (ISpDeviceClass         inClass,
  596.                                  UInt32                 inBufferCount,
  597.                                  UInt32 *                outCount,
  598.                                  ISpDeviceReference *    buffer);
  599.  
  600. EXTERN_API_C( OSStatus )
  601. ISpDevices_ExtractByIdentifier    (ISpDeviceIdentifier     inIdentifier,
  602.                                  UInt32                 inBufferCount,
  603.                                  UInt32 *                outCount,
  604.                                  ISpDeviceReference *    buffer);
  605.  
  606.  
  607. /*
  608.  * ISpDevices_ActivateClass, ISpDevices_DeactivateClass, ISpDevices_Activate, ISpDevices_Deactivate, ISpDevice_IsActive
  609.  *
  610.  * ISpDevices_Activate, ISpDevices_Deactivate
  611.  *
  612.  * This will activate/deactivate a block of devices.
  613.  * inDeviceCount - the number of devices to activate / deactivate
  614.  * inDevicesToActivate/inDevicesToDeactivate - a pointer to a block of memory contains the devices references
  615.  *
  616.  * ISpDevices_ActivateClass, ISpDevices_DeactivateClass
  617.  * inClass - the class of devices to activate or deactivate
  618.  *
  619.  * ISpDevice_IsActive
  620.  * inDevice - the device reference that you wish to 
  621.  * outIsActive - a boolean value that is true when the device is active
  622.  *
  623.  * Return Codes
  624.  * paramErr
  625.  *
  626.  */
  627. EXTERN_API_C( OSStatus )
  628. ISpDevices_ActivateClass        (ISpDeviceClass         inClass);
  629.  
  630. /* 1.1 or later*/
  631. EXTERN_API_C( OSStatus )
  632. ISpDevices_DeactivateClass        (ISpDeviceClass         inClass);
  633.  
  634. /* 1.1 or later*/
  635. EXTERN_API_C( OSStatus )
  636. ISpDevices_Activate                (UInt32                 inDeviceCount,
  637.                                  ISpDeviceReference *    inDevicesToActivate);
  638.  
  639. EXTERN_API_C( OSStatus )
  640. ISpDevices_Deactivate            (UInt32                 inDeviceCount,
  641.                                  ISpDeviceReference *    inDevicesToDeactivate);
  642.  
  643. EXTERN_API_C( OSStatus )
  644. ISpDevice_IsActive                (ISpDeviceReference     inDevice,
  645.                                  Boolean *                outIsActive);
  646.  
  647. /*
  648.  * ISpDevice_GetDefinition
  649.  *
  650.  *
  651.  * inDevice - the device you want to get the definition for
  652.  * inBuflen - the size of the structure (sizeof(ISpDeviceDefinition))
  653.  * outStruct - a pointer to where you want the structure copied
  654.  *
  655.  * Return Codes
  656.  * paramErr
  657.  *
  658.  */
  659. EXTERN_API_C( OSStatus )
  660. ISpDevice_GetDefinition            (ISpDeviceReference     inDevice,
  661.                                  UInt32                 inBuflen,
  662.                                  ISpDeviceDefinition *    outStruct);
  663.  
  664.  
  665. /*
  666.  *
  667.  * ISpDevice_GetElementList
  668.  *
  669.  * inDevice - the device whose element list you wish to get
  670.  * outElementList - a pointer to where you want a reference to that list stored
  671.  *
  672.  * Return Codes
  673.  * paramErr
  674.  *
  675.  */
  676. EXTERN_API_C( OSStatus )
  677. ISpDevice_GetElementList        (ISpDeviceReference     inDevice,
  678.                                  ISpElementListReference * outElementList);
  679.  
  680. /*
  681.  *
  682.  * takes an ISpElementReference and returns the group that it is in or 0 if there is
  683.  * no group
  684.  *
  685.  * Return Codes
  686.  * paramErr
  687.  *
  688.  */
  689. EXTERN_API_C( OSStatus )
  690. ISpElement_GetGroup                (ISpElementReference     inElement,
  691.                                  UInt32 *                outGroup);
  692.  
  693. /*
  694.  *
  695.  * takes an ISpElementReference and returns the device that the element belongs 
  696.  * to.
  697.  *
  698.  * Return Codes
  699.  * paramErr if inElement is 0 or outDevice is nil
  700.  *
  701.  */
  702. EXTERN_API_C( OSStatus )
  703. ISpElement_GetDevice            (ISpElementReference     inElement,
  704.                                  ISpDeviceReference *    outDevice);
  705.  
  706. /*
  707.  *
  708.  * takes an ISpElementReference and gives the ISpElementInfo for that Element.  This is the
  709.  * the set of standard information.  You get ISpElementKind specific information
  710.  * through ISpElement_GetConfigurationInfo.
  711.  *
  712.  * Return Codes
  713.  * paramErr if inElement is 0 or outInfo is nil
  714.  *
  715.  */
  716. EXTERN_API_C( OSStatus )
  717. ISpElement_GetInfo                (ISpElementReference     inElement,
  718.                                  ISpElementInfoPtr         outInfo);
  719.  
  720. /*
  721.  *
  722.  *         
  723.  *
  724.  * takes an ISpElementReference and gives the ISpElementKind specific configuration information
  725.  * 
  726.  * if buflen is not long enough to hold the information ISpElement_GetConfigurationInfo will
  727.  * copy buflen bytes of the data into the block of memory pointed to by configInfo and
  728.  * will return something error.
  729.  *
  730.  * Return Codes
  731.  * paramErr if inElement or configInfo is nil
  732.  *
  733.  */
  734. EXTERN_API_C( OSStatus )
  735. ISpElement_GetConfigurationInfo    (ISpElementReference     inElement,
  736.                                  UInt32                 buflen,
  737.                                  void *                    configInfo);
  738.  
  739. /*
  740.  *
  741.  * ISpElement_GetSimpleState
  742.  *
  743.  * Takes an ISpElementReference and returns the current state of that element.  This is a 
  744.  * specialized version of ISpElement_GetComplexState that is only appropriate for elements
  745.  * whose data fits in a signed 32 bit integer.
  746.  *
  747.  *
  748.  *
  749.  * Return Codes
  750.  * paramErr if inElement is 0 or state is nil
  751.  *
  752.  */
  753. EXTERN_API_C( OSStatus )
  754. ISpElement_GetSimpleState        (ISpElementReference     inElement,
  755.                                  UInt32 *                state);
  756.  
  757. /*
  758.  *
  759.  * ISpElement_GetComplexState
  760.  *
  761.  * Takes an ISpElementReference and returns the current state of that element.  
  762.  * Will copy up to buflen bytes of the current state of the device into
  763.  * state.
  764.  *
  765.  *
  766.  * Return Codes
  767.  * paramErr if inElement is 0 or state is nil
  768.  *
  769.  */
  770. EXTERN_API_C( OSStatus )
  771. ISpElement_GetComplexState        (ISpElementReference     inElement,
  772.                                  UInt32                 buflen,
  773.                                  void *                    state);
  774.  
  775.  
  776. /*
  777.  * ISpElement_GetNextEvent
  778.  *
  779.  * It takes in an element  reference and the buffer size of the ISpElementEventPtr
  780.  * it will set wasEvent to true if there was an event and false otherwise.  If there
  781.  * was not enough space to fill in the whole event structure that event will be
  782.  * dequed, as much of the event as will fit in the buffer will by copied and
  783.  * ISpElement_GetNextEvent will return an error.
  784.  *
  785.  * Return Codes
  786.  * paramErr
  787.  *
  788.  */
  789. EXTERN_API_C( OSStatus )
  790. ISpElement_GetNextEvent            (ISpElementReference     inElement,
  791.                                  UInt32                 bufSize,
  792.                                  ISpElementEventPtr     event,
  793.                                  Boolean *                wasEvent);
  794.  
  795. /*
  796.  *
  797.  * ISpElement_Flush
  798.  *
  799.  * It takes an ISpElementReference and flushes all the events on that element.  All it guaruntees is
  800.  * that any events that made it to this layer before the time of the flush call will be flushed and
  801.  * it will not flush any events that make it to this layer after the time when the call has returned.
  802.  * What happens to events that occur during the flush is undefined.
  803.  *
  804.  *
  805.  * Return Codes
  806.  * paramErr
  807.  *
  808.  */
  809. EXTERN_API_C( OSStatus )
  810. ISpElement_Flush                (ISpElementReference     inElement);
  811.  
  812.  
  813. /*
  814.  * ISpElementList_New
  815.  *
  816.  * Creates a new element list and returns it in outElementList.  In count specifies 
  817.  * the number of element references in the list pointed to by inElements.  If inCount
  818.  * is non zero the list is created with inCount elements in at as specified by the 
  819.  * inElements parameter.  Otherwise the list is created empty.
  820.  *
  821.  *
  822.  * Return Codes
  823.  * out of memory - If it failed to allocate the list because it was out of memory
  824.                    it will also set outElementList to 0
  825.  * paramErr if outElementList was nil
  826.  *
  827.  *
  828.  * Special Concerns
  829.  *
  830.  * interrupt unsafe
  831.  *
  832.  */
  833. EXTERN_API_C( OSStatus )
  834. ISpElementList_New                (UInt32                 inCount,
  835.                                  ISpElementReference *    inElements,
  836.                                  ISpElementListReference * outElementList,
  837.                                  UInt32                 flags);
  838.  
  839. /*
  840.  * ISpElementList_Dispose
  841.  *
  842.  * Deletes an already existing memory list.  
  843.  *
  844.  *
  845.  * Return Codes
  846.  * paramErr if inElementList was 0
  847.  *
  848.  *
  849.  * Special Concerns
  850.  *
  851.  * interrupt unsafe
  852.  *
  853.  */
  854. EXTERN_API_C( OSStatus )
  855. ISpElementList_Dispose            (ISpElementListReference  inElementList);
  856.  
  857. /*
  858.  * ISpGetGlobalElementList
  859.  *
  860.  * returns the global element list
  861.  *
  862.  * Return Codes
  863.  * paramErr if outElementList is nil
  864.  *
  865.  */
  866. EXTERN_API_C( OSStatus )
  867. ISpGetGlobalElementList            (ISpElementListReference * outElementList);
  868.  
  869. /*
  870.  * ISpElementList_AddElement
  871.  *
  872.  * adds an element to the element list
  873.  *
  874.  * Return Codes
  875.  * paramErr if inElementList is 0 or newElement is 0
  876.  * memory error if the system is unable to allocate enough memory
  877.  *
  878.  * Special Concerns
  879.  * interrupt Unsafe
  880.  * 
  881.  */
  882. EXTERN_API_C( OSStatus )
  883. ISpElementList_AddElements        (ISpElementListReference  inElementList,
  884.                                  UInt32                 refCon,
  885.                                  UInt32                 count,
  886.                                  ISpElementReference *    newElements);
  887.  
  888. /*
  889.  * ISpElementList_RemoveElement
  890.  *
  891.  * removes the specified element from the element list
  892.  *
  893.  * Return Codes
  894.  * paramErr if inElementList is 0 or oldElement is 0
  895.  * memory error if the system is unable to allocate enough memory
  896.  *
  897.  * Special Concerns
  898.  * interrupt Unsafe
  899.  * 
  900.  */
  901. EXTERN_API_C( OSStatus )
  902. ISpElementList_RemoveElements    (ISpElementListReference  inElementList,
  903.                                  UInt32                 count,
  904.                                  ISpElementReference *    oldElement);
  905.  
  906. /*
  907.  * ISpElementList_Extract
  908.  *
  909.  * ISpElementList_Extract will extract as many of the elements from an element list as possible.  You pass
  910.  * in an element list, a pointer to an array of element references and the number of elements in that array.
  911.  * It will return how many items are in the element list in the outCount parameter and copy the minimum of 
  912.  * that number and the size of the array into the buffer.
  913.  *
  914.  * ByKind and ByLabel are the same except that they will only count and copy element references to elements
  915.  * that have the specified kind and label.
  916.  *
  917.  * Return Codes
  918.  * paramErr
  919.  *
  920.  */
  921. EXTERN_API_C( OSStatus )
  922. ISpElementList_Extract            (ISpElementListReference  inElementList,
  923.                                  UInt32                 inBufferCount,
  924.                                  UInt32 *                outCount,
  925.                                  ISpElementReference *    buffer);
  926.  
  927. EXTERN_API_C( OSStatus )
  928. ISpElementList_ExtractByKind    (ISpElementListReference  inElementList,
  929.                                  ISpElementKind         inKind,
  930.                                  UInt32                 inBufferCount,
  931.                                  UInt32 *                outCount,
  932.                                  ISpElementReference *    buffer);
  933.  
  934. EXTERN_API_C( OSStatus )
  935. ISpElementList_ExtractByLabel    (ISpElementListReference  inElementList,
  936.                                  ISpElementLabel         inLabel,
  937.                                  UInt32                 inBufferCount,
  938.                                  UInt32 *                outCount,
  939.                                  ISpElementReference *    buffer);
  940.  
  941. /*
  942.  * ISpElementList_GetNextEvent
  943.  *
  944.  * It takes in an element list reference and the buffer size of the ISpElementEventPtr
  945.  * it will set wasEvent to true if there was an event and false otherwise.  If there
  946.  * was not enough space to fill in the whole event structure that event will be
  947.  * dequed, as much of the event as will fit in the buffer will by copied and
  948.  * ISpElementList_GetNextEvent will return an error.
  949.  *
  950.  * Return Codes
  951.  * paramErr
  952.  *
  953.  */
  954. EXTERN_API_C( OSStatus )
  955. ISpElementList_GetNextEvent        (ISpElementListReference  inElementList,
  956.                                  UInt32                 bufSize,
  957.                                  ISpElementEventPtr     event,
  958.                                  Boolean *                wasEvent);
  959.  
  960. /*
  961.  *
  962.  * ISpElementList_Flush
  963.  *
  964.  * It takes an ISpElementListReference and flushes all the events on that list.  All it guaruntees is
  965.  * that any events that made it to this layer before the time of the flush call will be flushed and
  966.  * it will not flush any events that make it to this layer after the time when the call has returned.
  967.  * What happens to events that occur during the flush is undefined.
  968.  *
  969.  *
  970.  * Return Codes
  971.  * paramErr
  972.  *
  973.  */
  974. EXTERN_API_C( OSStatus )
  975. ISpElementList_Flush            (ISpElementListReference  inElementList);
  976.  
  977. /*
  978.  *
  979.  * ISpTimeToMicroseconds
  980.  *
  981.  *
  982.  * This function takes time from an input sprocket event and converts it
  983.  * into microseconds. (Version 1.2 or later of InputSprocket.)
  984.  *
  985.  *
  986.  * Return Codes
  987.  * paramErr
  988.  *
  989.  */
  990. EXTERN_API_C( OSStatus )
  991. ISpTimeToMicroseconds            (const AbsoluteTime *    inTime,
  992.                                  UnsignedWide *            outMicroseconds);
  993.  
  994. /*
  995.  *
  996.  * ISpUptime
  997.  *
  998.  *
  999.  * This funtion returns the current machine dependant time, identical in form
  1000.  * to that in an InputSprocket event. (Version 1.1 or later of InputSprocket).
  1001.  *
  1002.  *
  1003.  */
  1004. EXTERN_API_C( AbsoluteTime )
  1005. ISpUptime                        (void);
  1006.  
  1007.  
  1008. /****************************************************************************/
  1009. /*    Interfaces for InputSprocket Drivers                                    */
  1010. /*                                                                            */
  1011. /*    These APIs should be called only from InputSprocket drivers                */
  1012. /*                                                                            */
  1013. /*    (Moved from InputSprocketDriver.h, which is now obsolete.                */
  1014. /****************************************************************************/
  1015.  
  1016. /*
  1017.  
  1018. Resource File Concerns
  1019.  
  1020. 1. All resource ids of a driver should be in the range of 256 to 2048
  1021. and the res file should only be open while the drivers panel is visable.
  1022.  
  1023. */
  1024. enum {
  1025.     kOSType_ISpDriverFileType    = FOUR_CHAR_CODE('shlb'),
  1026.     kOSType_ISpDriverCreator    = FOUR_CHAR_CODE('insp')
  1027. };
  1028.  
  1029. /*
  1030.  *
  1031.  * this function will plot an icon suite of the application (usually for a need)
  1032.  *
  1033.  */
  1034. EXTERN_API_C( OSErr )
  1035. ISpPlotAppIconSuite                (const Rect *            theRect,
  1036.                                  IconAlignmentType         align,
  1037.                                  IconTransformType         transform,
  1038.                                  short                     iconSuiteResourceId);
  1039.  
  1040. /* label2,5,6,7, disabled and offline are reserved*/
  1041.  
  1042. enum {
  1043.     kISpIconTransform_Selected    = kTransformSelected,            /* choose one of these (optionally) (these all erase what is behind them to the dialog color)*/
  1044.     kISpIconTransform_PlotIcon    = kTransformLabel1,
  1045.     kISpIconTransform_PlotPopupButton = kTransformLabel3,
  1046.     kISpIconTransform_PlotButton = kTransformLabel4,            /* use this is you want to plot the icon while the devices button is pressed*/
  1047.                                                                 /* or the devices axis is activated and so on*/
  1048.     kISpIconTransform_DeviceActive = kTransformOpen
  1049. };
  1050.  
  1051.  
  1052. typedef UInt32                             ISpMetaHandlerSelector;
  1053. enum {
  1054.     kISpSelector_Init            = 1,
  1055.     kISpSelector_Stop            = 2,
  1056.     kISpSelector_GetSize        = 3,
  1057.     kISpSelector_HandleEvent    = 4,
  1058.     kISpSelector_Show            = 5,
  1059.     kISpSelector_Hide            = 6,
  1060.     kISpSelector_BeginConfiguration = 7,
  1061.     kISpSelector_EndConfiguration = 8,
  1062.     kISpSelector_GetIcon        = 9,
  1063.     kISpSelector_GetState        = 10,
  1064.     kISpSelector_SetState        = 11,
  1065.     kISpSelector_Dirty            = 12,
  1066.     kISpSelector_SetActive        = 13,
  1067.     kISpSelector_DialogItemHit    = 14,
  1068.     kISpSelector_Tickle            = 15,                            /* 1.03 and later*/
  1069.     kISpSelector_InterruptTickle = 16,
  1070.     kISpSelector_Draw            = 17,
  1071.     kISpSelector_Click            = 18,
  1072.     kISpSelector_ADBReInit        = 19,                            /* 1.2 and later*/
  1073.     kISpSelector_GetCalibration    = 20,                            /* 1.7 and later*/
  1074.     kISpSelector_SetCalibration    = 21,
  1075.     kISpSelector_CalibrateDialog = 22
  1076. };
  1077.  
  1078.  
  1079. /*
  1080.  *
  1081.  * typedefs for the function pointers the metahandler may return 
  1082.  *
  1083.  */
  1084. /* a generic driver function pointer */
  1085. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_Generic )(UInt32 refCon,  ...);
  1086. /* the meta handler pointer */
  1087. typedef CALLBACK_API_C( ISpDriverFunctionPtr_Generic , ISpDriverFunctionPtr_MetaHandler )(UInt32 refCon, ISpMetaHandlerSelector metaHandlerSelector);
  1088. /* the pointers you get through the meta handler */
  1089. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_Init )(UInt32 refCon, UInt32 count, ISpNeed needs[], ISpElementReference virtualElements[], Boolean used[], OSType appCreatorCode, OSType subCreatorCode, UInt32 reserved, void *reserved2);
  1090. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_Stop )(UInt32 refCon);
  1091. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_GetSize )(UInt32 refCon, Point *minimum, Point *best);
  1092. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_HandleEvent )(UInt32 refCon, EventRecord *theEvent, Boolean *handled);
  1093. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_Show )(UInt32 refCon, DialogPtr theDialog, short dialogItemNumber, Rect *r);
  1094. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_Hide )(UInt32 refCon);
  1095. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_BeginConfiguration )(UInt32 refCon, UInt32 count, ISpNeed needs[]);
  1096. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_EndConfiguration )(UInt32 refCon, Boolean accept);
  1097. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_GetIcon )(UInt32 refCon, short *iconSuiteResourceId);
  1098. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_GetState )(UInt32 refCon, UInt32 buflen, void *buffer, UInt32 *length);
  1099. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_SetState )(UInt32 refCon, UInt32 length, void *buffer);
  1100. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_Dirty )(UInt32 refCon, Boolean *dirty);
  1101. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_SetActive )(UInt32 refCon, Boolean active);
  1102. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_DialogItemHit )(UInt32 refCon, short itemHit);
  1103. /* 1.03 and later*/
  1104. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_Tickle )(UInt32 refCon);
  1105. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_InterruptTickle )(UInt32 refCon);
  1106. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_Draw )(UInt32 refCon);
  1107. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_Click )(UInt32 refCon, const EventRecord *event);
  1108. /* 1.2 and later*/
  1109. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_ADBReInit )(UInt32 refCon, Boolean inPostProcess);
  1110. /* 1.7 and later*/
  1111. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_GetCalibration )(UInt32 refCon, void *calibration, Size *calibrationSize);
  1112. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_SetCalibration )(UInt32 refCon, void *calibration, Size calibrationSize);
  1113. typedef CALLBACK_API_C( OSStatus , ISpDriverFunctionPtr_CalibrateDialog )(UInt32 refCon, Boolean *changed);
  1114. /* these functions are exported in the driver's pef container (1.7 or later)*/
  1115. EXTERN_API_C( OSStatus )
  1116. ISpDriver_CheckConfiguration    (Boolean *                validConfiguration);
  1117.  
  1118. EXTERN_API_C( OSStatus )
  1119. ISpDriver_FindAndLoadDevices    (Boolean *                keepDriverLoaded);
  1120.  
  1121. EXTERN_API_C( OSStatus )
  1122. ISpDriver_DisposeDevices        (void);
  1123.  
  1124. EXTERN_API_C( void )
  1125. ISpDriver_Tickle                (void);
  1126.  
  1127. typedef CALLBACK_API_C( OSStatus , ISpDriver_CheckConfigurationPtr )(Boolean *validConfiguration);
  1128. typedef CALLBACK_API_C( OSStatus , ISpDriver_FindAndLoadDevicesPtr )(Boolean *keepDriverLoaded);
  1129. typedef CALLBACK_API_C( OSStatus , ISpDriver_DisposeDevicesPtr )(void );
  1130. typedef CALLBACK_API_C( void , ISpDriver_TicklePtr )(void );
  1131. /* ********************* driver level functions ********************* */
  1132.  
  1133. /*
  1134.  *
  1135.  * ISpDevice_New
  1136.  *
  1137.  * This creates a new device from the device definition structure and returns
  1138.  * the result into the device reference.
  1139.  *
  1140.  * Returns Codes
  1141.  * paramErr
  1142.  * out of memory
  1143.  * 
  1144.  * Specical Considerations
  1145.  * may not be done at interrupt time
  1146.  */
  1147. EXTERN_API_C( OSStatus )
  1148. ISpDevice_New                    (const ISpDeviceDefinition * inStruct,
  1149.                                  ISpDriverFunctionPtr_MetaHandler  metaHandler,
  1150.                                  UInt32                 refCon,
  1151.                                  ISpDeviceReference *    outReference);
  1152.  
  1153. /*
  1154.  * ISpDevice_Dispose
  1155.  *
  1156.  * This disposes an existing device.
  1157.  *
  1158.  * Returns Codes
  1159.  * paramErr
  1160.  *
  1161.  * Special Considerations
  1162.  * May not be done at interrupt time
  1163.  *
  1164.  */
  1165. EXTERN_API_C( OSStatus )
  1166. ISpDevice_Dispose                (ISpDeviceReference     inReference);
  1167.  
  1168.  
  1169. /*
  1170.  *
  1171.  * ISpElementDefinitionStruct
  1172.  *
  1173.  * This is the structure that defines everything static about this
  1174.  * element.  For each element on your device you will need to 
  1175.  * fill in one of these structures when your driver loads.
  1176.  *
  1177.  */
  1178. struct ISpElementDefinitionStruct
  1179. {
  1180.     ISpDeviceReference device;  /* device this element belongs to */
  1181.     UInt32 group;                /* group this element belongs to or 0 */
  1182.  
  1183.     Str63 theString;         /* a string that is a human readable identifier for this element, internationalization ? */
  1184.  
  1185.     ISpElementKind kind;
  1186.     ISpElementLabel label;
  1187.  
  1188.     void *configInfo;         /* a pointer to the buffer containing the configuration information for this element */
  1189.     UInt32 configInfoLength; /* length of that configuration info */
  1190.  
  1191.     UInt32 dataSize;         /* the size of the data, so we can generate an appropriate buffer */
  1192.  
  1193.     UInt32 reserved1;
  1194.     UInt32 reserved2;
  1195.     UInt32 reserved3;
  1196. };
  1197. typedef struct ISpElementDefinitionStruct ISpElementDefinitionStruct;
  1198. /*
  1199.  *
  1200.  * ISpElement_New
  1201.  *
  1202.  * ISpElement_New takes an element definition struct and gives you back a element reference.
  1203.  * When you produce data you use that element reference to give the data to the system.
  1204.  * 
  1205.  * Return Codes
  1206.  * paramErr
  1207.  * memory error
  1208.  *
  1209.  * Special Considerations
  1210.  * The ISpElement_New function may move or purge memory.  Your application should not call this function 
  1211.  * at interrupt time.
  1212.  * 
  1213.  */
  1214. EXTERN_API_C( OSStatus )
  1215. ISpElement_New                    (const ISpElementDefinitionStruct * inStruct,
  1216.                                  ISpElementReference *    outElement);
  1217.  
  1218. /*
  1219.  *
  1220.  * ISpElement_Dispose
  1221.  *
  1222.  * ISpElement_Dispose takes an element reference and deletes it.
  1223.  * You should call this function when your driver unloads.
  1224.  *
  1225.  * Return Codes
  1226.  * paramErr
  1227.  * memory error
  1228.  *
  1229.  * Special Considerations
  1230.  * The ISpElement_Dispose function may move or purge memory.  Your application should not call this function 
  1231.  * at interrupt time.
  1232.  * 
  1233.  */
  1234. EXTERN_API_C( OSStatus )
  1235. ISpElement_Dispose                (ISpElementReference     inElement);
  1236.  
  1237. /*
  1238.  *
  1239.  * ISpElement_PushSimpleData
  1240.  *
  1241.  * ISpElement_PushSimpleData is the appropriate way to give the system data if your data fits exactly into
  1242.  * a 32 bit signed number.  You pass the element reference that goes with the data, the data and the 
  1243.  * AbsoluteTime that data was produced.  If UpTime is not available you should fill time.lo with the
  1244.  * TickCount time and time.hi with 0.
  1245.  *
  1246.  * Return Codes
  1247.  * paramErr
  1248.  *
  1249.  */
  1250. EXTERN_API_C( OSStatus )
  1251. ISpElement_PushSimpleData        (ISpElementReference     inElement,
  1252.                                  UInt32                 data,
  1253.                                  const AbsoluteTime *    time);
  1254.  
  1255. /*
  1256.  *
  1257.  * ISpElement_PushComplexData
  1258.  *
  1259.  * ISpElement_PushComplexData is exactly like ISpElement_PushSimpleData except that it is appropriate for times
  1260.  * when your data does not fit into a signed 32 bit integer.
  1261.  *
  1262.  * Instead it takes the length of your data (which must match the datasize field of your ISpElementDefinitionStruct)
  1263.  * and a ptr to the devices state.
  1264.  *
  1265.  * Return Codes
  1266.  * paramErr
  1267.  *
  1268.  */
  1269. EXTERN_API_C( OSStatus )
  1270. ISpElement_PushComplexData        (ISpElementReference     inElement,
  1271.                                  UInt32                 buflen,
  1272.                                  void *                    state,
  1273.                                  const AbsoluteTime *    time);
  1274.  
  1275. /*  ***********************************************************************************  */
  1276. typedef UInt32                             ISpADBDeferRef;
  1277. typedef CALLBACK_API_C( void , ISpADBDeferCallbackProcPtr )(UInt8 adbCommand, void *adbBuffer, UInt32 refcon);
  1278. EXTERN_API_C( OSErr )
  1279. ISpAllocateADBDeferBlock        (ISpADBDeferRef *        createBlock);
  1280.  
  1281. EXTERN_API_C( OSErr )
  1282. ISpDisposeADBDeferBlock            (ISpADBDeferRef         disposeBlock);
  1283.  
  1284. EXTERN_API_C( OSErr )
  1285. ISpInstallADBDefer                (ISpADBDeferRef         refBlock,
  1286.                                  ADBAddress             reqAddress,
  1287.                                  ISpADBDeferCallbackProcPtr  installProc,
  1288.                                  UInt32                 clientRefCon,
  1289.                                  ADBServiceRoutineUPP *    prevRoutine,
  1290.                                  Ptr *                    prevDataArea);
  1291.  
  1292. EXTERN_API_C( OSErr )
  1293. ISpRemoveADBDefer                (ISpADBDeferRef         refBlock);
  1294.  
  1295.  
  1296. #if PRAGMA_STRUCT_ALIGN
  1297.     #pragma options align=reset
  1298. #elif PRAGMA_STRUCT_PACKPUSH
  1299.     #pragma pack(pop)
  1300. #elif PRAGMA_STRUCT_PACK
  1301.     #pragma pack()
  1302. #endif
  1303.  
  1304. #ifdef PRAGMA_IMPORT_OFF
  1305. #pragma import off
  1306. #elif PRAGMA_IMPORT
  1307. #pragma import reset
  1308. #endif
  1309.  
  1310. #ifdef __cplusplus
  1311. }
  1312. #endif
  1313.  
  1314. #endif /* __INPUTSPROCKET__ */
  1315.  
  1316.